package com.d0324;

import java.util.Comparator;

public class StudentAgeComparator implements Comparator<Student> {
    /*@Override
    public int compareTo(Student o1,Student o2) {
        if (o1.getAge()>o2.getAge()){
            return 1;
        }else if (o1.getAge()<o2.getAge()){
            return -1;
        }else {
            return 0;
        }
    }*/

    /*@Override
    public int compare(Student o1, Student o2) {
        if (o1.getAge()>o2.getAge()){
            return 1;
        }else if (o1.getAge()<o2.getAge()){
            return -1;
        }else {
            return 0;
        }
    }*/
    @Override
    public int compare(Student o1, Student o2) {
        if (o1.getSrcoe()>o2.getSrcoe()){
            return 1;
        }else if (o1.getSrcoe()<o2.getSrcoe()){
            return -1;
        }else {
            return 0;
        }
    }
}
